﻿Imports System
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
<Serializable()> Public Class GridDepos
    Private m_GridDEPOS(-1, -1) As ResultDEPOS
    Private m_GridDEPOSContourFileName As String '用于储存背景贡献浓度的等值线文件名称
    Private m_MaxValueDEPOS As Double = 9999999 '网格最大总沉积值
    Private m_MinValueDEPOS As Double = 0 '网格最小总沉积值
    Private m_GridMaxDEPOS As New ResultDEPOS  '储存网格中总沉积最大值

    ''' <summary>
    ''' 网格点的浓度
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridDEPOS() As ResultDEPOS(,)
        Get
            Return Me.m_GridDEPOS
        End Get
        Set(ByVal value As ResultDEPOS(,))
            Me.m_GridDEPOS = value
        End Set
    End Property
    ''' <summary>
    ''' 用于储存背景贡献浓度的等值线文件名称
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridDEPOSContourFileName() As String
        Get
            Return Me.m_GridDEPOSContourFileName
        End Get
        Set(ByVal value As String)
            Me.m_GridDEPOSContourFileName = value
        End Set
    End Property

    ''' <summary>
    ''' 网格最大总沉积值
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property MaxValueDEPOS() As Double
        Get
            Return m_MaxValueDEPOS
        End Get
        Set(ByVal value As Double)
            m_MaxValueDEPOS = value
        End Set
    End Property
    ''' <summary>
    ''' 网格最小总沉积值
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property MinValueDEPOS() As Double
        Get
            Return m_MinValueDEPOS
        End Get
        Set(ByVal value As Double)
            m_MinValueDEPOS = value
        End Set
    End Property
    ''' <summary>
    ''' 储存网格中总沉积最大值
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridMaxDEPOS() As ResultDEPOS
        Get
            Return m_GridMaxDEPOS
        End Get
        Set(ByVal value As ResultDEPOS)
            m_GridMaxDEPOS = value
        End Set
    End Property
    ''' <summary>
    ''' 计算最大值和最小值
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub CalMaxAndMinValue(ByVal Xnum As Integer, ByVal Ynum As Integer)
        Me.m_MaxValueDEPOS = Me.m_GridDEPOS(0, 0).DEPOS
        Me.m_MinValueDEPOS = Me.m_GridDEPOS(0, 0).DEPOS
        For i As Integer = 0 To Ynum - 1
            For j As Integer = 0 To Xnum - 1
                If Me.m_MaxValueDEPOS < Me.m_GridDEPOS(i, j).DEPOS Then
                    Me.m_MaxValueDEPOS = Me.m_GridDEPOS(i, j).DEPOS
                End If
                If Me.m_MinValueDEPOS > Me.m_GridDEPOS(i, j).DEPOS Then
                    Me.m_MinValueDEPOS = Me.m_GridDEPOS(i, j).DEPOS
                End If
            Next
        Next
    End Sub

End Class
